package com.gitee.wsl.compose.animation.transition

import androidx.compose.animation.core.FiniteAnimationSpec
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.runtime.Stable

//淡入动画。该动画会使对象逐渐从不可见到可见，产生渐变效果
@Stable
fun Transition.In.fade(
    animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow),
    initialAlpha: Float = 0f
) = fadeIn(animationSpec,initialAlpha)

//淡出动画。该动画会使对象逐渐从可见到不可见，产生渐变效果。
@Stable
fun Transition.Out.fade(
    animationSpec: FiniteAnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow),
    targetAlpha: Float = 0f,
) = fadeOut(animationSpec, targetAlpha)